[mirrors]
http://downloads.sourceforge.net/project/netpbm/archive_of_old_release_system/10.34/netpbm-10.34.tgz

[vars]
filesize=2507007
sha512=5d5a2ad223762725d195dae492463c115210ab04a528982bb2bb304ca17dfda817a6685e69b75755195b2b7a940fa9148494ad91bbf2ea63fcdbf5cc709de21a
desc="Netpbm is a CLI toolkit for conversion and manipulation of images"

[deps]
libpng
giflib
libtiff
libjpeg
zlib

[build]
# BK
# note, we use 10.34 in Puppy Linux, as later versions do not work in at least
# one of our scripts. we never followed this up with the developer.
# converter/ppm/xpmtoppm.c has getline(), conflicts with /usr/include/stdio.h
# i have inserted a rename to my_getline().
#oh man, this is a hairy build!!!...

#from T2...
patch -p1 < "$K"/netpbm-glibc.patch
patch -p1 < "$K"/netpbm-jpeg.patch
patch -p1 < "$K"/netpbm-makefile.patch
patch -p1 < "$K"/netpbm-shared_files-fix.patch
patch -p1 < "$K"/netpbm-zlib.patch

{ echo -e "\ngnu\nregular\nshared\ny\n\n\n"
  echo -e "\n\n\n\n\n\n`pkgprefix libdir libx11`/libX11.so\n\nnone\n" ; } | ./configure

sed -i -e 's%getline%my_getline%' converter/ppm/xpmtoppm.c
sed -i -e 's% -ffast-math % -ffast-math -flax-vector-conversions -fPIC -lz %' Makefile.config

make

[ -d /tmp/netpbm.bin ] && rm -rf /tmp/netpbm.bin
make package pkgdir=/tmp/netpbm.bin

dest="$butch_install_dir""$butch_prefix"

#this doesn't work when installing to /, easier to do it manually...
#{ echo -e "/tmp/netpbm.bin"
#  echo -e "$dest\n$dest/bin\n$dest/lib"
#  echo -e "n"
#  echo -e "$dest/lib\n$dest/share\n\n\n\nn\n" ; } | ./installnetpbm

#only want a cutdown selection...
mkdir -p "$dest"/bin
for APPLET in anytopnm giftopnm jpegtopnm pamcomp pamcut pamdice pamfile pamrgbatopng pamscale pamslice pamsplit pamstretch pamtotiff pbmtext pbmtoxbm pgmramp pgmtopbm pgmtoppm pngtopnm pnmalias pnmcat pnmcolormap pnmconvol pnmcut pnmfile pnminterp pnmnlfilt pnmquant pnmremap pnmrotate pnmscale pnmsmooth pnmsplit pnmtojpeg pnmtopng pnmtops ppmdither ppmlabel ppmquant ppmrainbow ppmrough ppmtobmp ppmtogif ppmtojpeg ppmtopgm ppmtoxpm pstopnm tifftopnm xbmtopbm xpmtoppm xwdtopnm
do
 [ ! -e /tmp/netpbm.bin/bin/${APPLET} ] && continue
 cp -a -f --remove-destination /tmp/netpbm.bin/bin/${APPLET} "$dest"/bin/
done
cp -a -f --remove-destination /tmp/netpbm.bin/lib/* "$dest"/lib/
cp -a -f --remove-destination /tmp/netpbm.bin/misc/* "$dest"/share/

rm -rf /tmp/netpbm.bin

